import service from '@/utils/request'
// /sys/user/simple
export const getEmployees = () => {
  return service('/sys/user/simple')
}

// 获取员工列表
export const getEmployeesList = params => {
  return service({
    url: '/sys/user',
    method: 'get',
    params
  })
}

// 删除员工
export const deleteEmployees = id => {
  return service({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

// Path： /sys/user

// Method： POST
// 新增员工
export const addEmployees = ({
  username,
  mobile,
  formOfEmployment,
  workNumber,
  departmentName,
  timeOfEntry,
  correctionTime
}) => {
  return service({
    url: '/sys/user',
    method: 'post',
    data: {
      username,
      mobile,
      formOfEmployment,
      workNumber,
      departmentName,
      timeOfEntry,
      correctionTime
    }
  })
}
// export const addEmployees = data => {
//   return service({
//     url: '/sys/user',
//     method: 'post',
//     data
//   })
// }

// 批量导入
// Path： /sys/user/batch

// Method： POST
// 删除员工
export const importEmployees = data => {
  return service({
    url: `/sys/user/batch`,
    method: 'POST',
    data
  })
}

//  保存员工基本信息
// Path： /sys/user/{id}

// Method： PUT
export const saveEmployees = (id, data) => {
  return service({
    url: `/sys/user/${id}`,
    method: 'put',
    data
  })
}

// 获取员工详情
// Path： /employees/{id}/personalInfo

// Method： GET
export const getEmployeesDetail = id => {
  return service({
    url: `/employees/${id}/personalInfo`
  })
}

// 岗位信息接口
export function getJobDetail (id) {
  return service({
    url: `/employees/${id}/jobs`
  })
}

// 修改岗位信息接口
export function updateJob (data) {
  return service({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
